package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(DemoApplication.class, args);

        Environment env = application.getEnvironment();
        String ip =  InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        System.out.println("Running DemoApplication on " + ip + ":" + port);

    }

}
